package cn.stylefeng.guns.modular.business.frequency.orderfinishimage.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderfinishimage.service.OrderFinishImageService;
import cn.stylefeng.guns.modular.business.frequency.orderfinishimage.model.param.OrderFinishImageParam;

import javax.annotation.Resource;

/**
 * 订单交付图片 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderFinishImageController {

    @Resource
    private OrderFinishImageService orderFinishImageService;

    /**
     * 分页查询订单交付图片
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderFinishImage/page")
    @BusinessLog(title = "订单交付图片_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderFinishImageParam orderFinishImageParam) {
        return new SuccessResponseData(orderFinishImageService.page(orderFinishImageParam));
    }

    /**
     * 获取全部订单交付图片
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderFinishImage/list")
    @BusinessLog(title = "订单交付图片_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderFinishImageParam orderFinishImageParam) {
        return new SuccessResponseData(orderFinishImageService.list(orderFinishImageParam));
    }

    /**
     * 查看详情订单交付图片
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderFinishImage/detail")
    @BusinessLog(title = "订单交付图片_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderFinishImageParam.detail.class) OrderFinishImageParam orderFinishImageParam) {
        return new SuccessResponseData(orderFinishImageService.detail(orderFinishImageParam));
    }

    /**
     * 添加订单交付图片
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderFinishImage/add")
    @BusinessLog(title = "订单交付图片_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderFinishImageParam.add.class) OrderFinishImageParam orderFinishImageParam) {
        orderFinishImageService.add(orderFinishImageParam);
        return new SuccessResponseData();
    }

    /**
     * 删除订单交付图片
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderFinishImage/delete")
    @BusinessLog(title = "订单交付图片_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderFinishImageParam.delete.class) OrderFinishImageParam orderFinishImageParam) {
        orderFinishImageService.delete(orderFinishImageParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑订单交付图片
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderFinishImage/edit")
    @BusinessLog(title = "订单交付图片_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderFinishImageParam.edit.class) OrderFinishImageParam orderFinishImageParam) {
        orderFinishImageService.edit(orderFinishImageParam);
        return new SuccessResponseData();
    }


}
